home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-28 | 1.7 KB | 68 lines | [TEXT/CWIE] |
- // * This module contains functions borrowed
- // * from the Infinity Windoid, written by Troy Gaul.
- // * ©1991-1995 Infinity Systems. All Rights Reserved.
-
- //#include "WindoidTypes.h"
- #include "WindoidUtil.h"
-
- static void
- UseDefaultColor(short index, RGBColor *theColor) {
- switch (index) {
- case wContentColor: // 0
- case wTitleBarColor: // 4
- case wHiliteColorLight: // 5
- case wTitleBarLight: // 7
- theColor->red = theColor->green = theColor->blue = 0xFFFF;
- break;
-
- case wDialogLight: // 9
- case wTingeLight: // 11
- theColor->red = theColor->green = 0xCCCC;
- theColor->blue = 0xFFFF;
- break;
-
- case wTingeDark: // 12
- theColor->red = theColor->green = 0x3333;
- theColor->blue = 0x6666;
- break;
-
- default:
- theColor->red = theColor->green = theColor->blue = 0;
- break;
- }
- }
-
- // -----------------------------------------------------------------------------
-
- void
- GetWctbColor(WindowPeek window, short partCode, RGBColor *theColor) {
-
- // Given a partCode, return the RGBColor associated with it. (Using the
- // default window color table.)
-
- AuxWinHandle awHndl;
- short count;
-
-
- // Get the Color table for the window if it has one.
-
- (void) GetAuxWin((WindowPtr) window, &awHndl);
- count = (**(WCTabHandle) ((**awHndl).awCTable)).ctSize;
-
-
- // If the table didn't contain the entry of interest, look to the
- // default table.
-
- if (count < partCode) {
- GetAuxWin(nil, &awHndl);
- count = (**(WCTabHandle) ((**awHndl).awCTable)).ctSize;
- }
-
-
- // If the entry is there, use it, if not make a best guess at a default value.
-
- if (count < partCode)
- UseDefaultColor(partCode, theColor);
- else
- *theColor = (**(WCTabHandle) ((**awHndl).awCTable)).ctTable[partCode].rgb;
- }